<html>
    <head>
        <title>Options for the HTML5 Autoplayer</title>
        <script type="text/javascript" src="dojo.js"></script>
        <script type="text/javascript">
            dojo.addOnLoad(function() {
                var playnext = localStorage["playnext"]
                if (playnext == undefined) {
                    localStorage["playnext"] = "true"
                }
                else if (playnext == "false") {
                    dojo.byId("playnext").checked = "false"
                }
                dojo.connect(dojo.byId("submit"), "onclick", saveSettings)
            })
            function saveSettings() {
                var playnext = dojo.byId("playnext")
                if (playnext.checked) {
                    localStorage['playnext'] = "true"
                }
                else {
                    localStorage['playnext'] = "false"
                }
                var saved = dojo.byId("status")
                saved.innerHTML = "Saved."
                playnext.parentNode.appendChild(saved)
                setTimeout(function() {
                    saved.innerHTML = ""
                }, 1000)
            }
        </script>
        <link href="options_styles.css" type="text/css" rel="stylesheet" />
    </head>
    <body>
        <div id="header">
            <img src="main-icon.jpg" />
        </div>
        <label for="playnext">Add a "Play next in playlist" button to videos in playlists?</label>
        <input checked="checked" type="checkbox" id="playnext" />
        <p>
            <button id="submit">
                Save
            </button>
        </p>
        <div style="font-weight:bold" id="status"></div>
    </body>
</html>